package com.charmzenus.champion.base;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

import com.umeng.commonsdk.UMConfigure;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by itheima.
 */

public class MyApplication extends Application {
    private static MyApplication context;
    private static int mainTid;
    private static Handler handler;

    public static Context getApplication() {
        return context;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        context = this;
        mainTid = android.os.Process.myTid();
        handler = new Handler();

        // 极光推送
        JPushInterface.setDebugMode(AppConfig.DEBUG);
        JPushInterface.init(context);

        /*
        注意: 即使您已经在AndroidManifest.xml中配置过appkey和channel值，
        也需要在App代码中调用初始化接口
        （如需要使用AndroidManifest.xml中配置好的appkey和channel值，
        UMConfigure.init调用中appkey和channel参数请置为null）。

        */
        UMConfigure.init(this,
                AppConfig.UMENT_APP_KEY,
                "Umeng",
                UMConfigure.DEVICE_TYPE_PHONE,
                null);
    }


    public static int getMainTid() {
        return mainTid;
    }

    public static Handler getHandler() {
        return handler;
    }
}
